<?
// sin errores
error_reporting(0);

$db_direccion = 'mysql2.000webhost.com';
$db_user = 'a4088847_dacan';
$db_pass = 'Dacan24';
$db_name = 'a4088847_dacan';
$db_table = 'noticias';
$db_campo_fecha = 'fecha';
$db_campo_titulo = 'titulo';
$db_campo_texto = 'cuerpo';
$db_campo_url = 'idNoticia';
$pg_titulo = 'Blog Beta';
$pg_link = 'http://dacanphp.net46.net';
$pg_descripcion = 'Ejemplo de dBlog';
$pg_idioma = 'es';
header("Content-Type: application/xml; charset=ISO-8859-1"); 
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?><rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">";
echo "<channel><title>{$pg_titulo}</title><link>{$pg_link}</link><description>{$pg_descripcion}</description><language>{$pg_idioma}</language>";
$db=mysql_connect($db_direccion,$db_user,$db_pass);
$sql="SELECT * FROM {$db_table}";
$qry = mysql_db_query($db_name,$sql,$db);
unset($sql);
if (mysql_num_rows($qry))
while ($row=mysql_fetch_array($qry)){
 echo " <item><title>{$row[$db_campo_titulo]}</title>";
 echo " <link>{$pg_link}</link><guid>{$pg_link}</guid>";
 $desc = str_replace("\n",'',$row[$db_campo_texto]);
 $desc = str_replace("\r",'',$desc);
 $desc = substr($desc,0,230);
 $desc = htmlentities($desc);
 echo " <description>{$desc}</description></item>";
}
echo "</channel></rss>";
?>